package com.zxx.pattern.iteratorPattern.iterator1;

import java.util.ArrayList;
import java.util.List;

/**
 * Animal集合类
 * @author zxx on 2021/3/17
 */
public class AnimalCollection {

    private List<String> animals;

    public AnimalCollection() {
        this.animals = new ArrayList<>();
    }

    public void addAnimal(String animal) {
        animals.add(animal);
    }

    public Iterator1 iterator() {
        return new AnimalIterator(animals);
    }

}
